class PackageDetailsController < ApplicationController
  def new
  	@package_detail = PackageDetail.new
  end

  def create
  	@package_detail = PackageDetail.new post_params
    if @package_detail.save
       redirect_to package_path(:id =>@package_detail.package.id)
    else
      render :action => 'new'
    end
  end

  def destroy
    @package_detail = PackageDetail.find params[:id]
    @package_detail.destroy
    redirect_to package_path(:id =>@package_detail.package.id)
  end

   def post_params
    params.require(:package_detail).permit(*%w(name package_id))
  end
end
